using System.Windows;
using System.Windows.Media.Animation;
using System.Windows.Controls;

namespace WikiApp.Controls
{
    public partial class ToastNotification : UserControl
    {
        public ToastNotification()
        {
            InitializeComponent();
        }

        public void Show(string message)
        {
            MessageText.Text = message;
            var showAnimation = (Storyboard)FindResource("ShowAnimation");
            showAnimation.Begin(this);
            
            // 3秒后自动隐藏
            var timer = new System.Windows.Threading.DispatcherTimer();
            timer.Interval = System.TimeSpan.FromSeconds(3);
            timer.Tick += (s, e) =>
            {
                timer.Stop();
                var hideAnimation = (Storyboard)FindResource("HideAnimation");
                hideAnimation.Begin(this);
            };
            timer.Start();
        }
    }
} 